<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Daily Bing Wallpaper</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
    <style>
      body {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
        margin: 0;
        padding: 0;
        color: white;
        font-family: Arial, sans-serif;
        background-position: center;
        background-size: cover;
      }
    </style>
  </head>
  <body>
    <script>
      fetch("https://api.timelessq.com/bing/random?format=json")
        .then((response) => response.json())
        .then((res) => {
          console.log(res.data);

          const imageUrl = res.data.url;
          const title = res.data.title;
          const copyright = res.data.copyright;

          // 设置背景图片
          document.body.style.backgroundImage = `url(${imageUrl})`;

          // 创建版权信息容器
          const container = document.createElement("div");
          container.innerHTML = `
            <h1>${title}</h1>
            <p>${copyright}</p>
          `;
          document.body.appendChild(container);
        })
        .catch((error) => {
          console.error("Error fetching Bing wallpaper:", error);
        });
    </script>
  </body>
</html>
